home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Web Graphics with Shout 3D
/
Interactive Web Graphics With Shout 3D.iso
/
mac
/
Code
/
Chapter Code.exe
/
Chapter09
/
ChangeTimeSensorsPanel.java
< prev
next >
Wrap
Text File
|
2000-08-29
|
1KB
|
68 lines
package applets;
import shout3d.*;
import shout3d.core.*;
import shout3d.math.*;
public class ChangeTimeSensorsPanel extends Shout3DPanel implements DeviceObserver {
TimeSensor timer;
TimeSensor timer2;
boolean firstAnim = true;
public ChangeTimeSensorsPanel (Shout3DApplet applet){
super(applet);
}
public void customInitialize() {
addDeviceObserver(this,"MouseInput", null);
timer = (TimeSensor) getNodeByName("timer");
timer2 = (TimeSensor) getNodeByName("timer2");
}
protected void finalize() {
removeDeviceObserver(this,"MouseInput");
}
public boolean onDeviceInput(DeviceInput di, Object userData) {
MouseInput mi = (MouseInput) di;
switch (mi.which){
case MouseInput.DOWN:
if(firstAnim) {
timer.stop();
timer2.start();
firstAnim = false;
return true;
}
else {
timer2.stop();
timer.start();
firstAnim = true;
return true;
}
}//end of switch
return false;
}
}//end of class